<% teams_to_add = nil
   manages_access = manages_cloud?(@cloud.ciId)
   if manages_access
     team_ids     = @teams.map(&:id)
     teams_to_add = current_user.organization.teams.where('teams.name <> ? AND NOT teams.org_scope AND (teams.manages_access OR teams.cloud_services OR teams.cloud_compliance OR teams.cloud_support)', Team::ADMINS)
     teams_to_add = teams_to_add.where('teams.id NOT IN (?)', team_ids) if team_ids.present?
     teams_to_add = teams_to_add.order(:name).all
   end %>
<%= section_panel 'Teams', :width => 'double', :position => 'left' do %>
  <%= render 'base/shared/team_list',
             :ci             => @cloud,
             :teams          => @teams,
             :manages_access => manages_access,
             :teams_to_add   => teams_to_add,
             :permissions    => %w(cloud_services cloud_compliance cloud_support) %>
<% end %>
